#include <windows.h>
#include <stdio.h>

#include "afxwin.h"

CWinApp* afxCurrentWinApp = NULL;

CWinApp::CWinApp()
{
	fprintf(stderr, "debug: CWinApp(0x%08X)::CWinApp()\n", this);

	afxCurrentWinApp = this;
}

BOOL CWinApp::InitInstance()
{
	fprintf(stderr, "debug: CWinApp(0x%08X)::InitInstance()\n", this);

	return TRUE;
}

int CWinApp::Run()
{
	fprintf(stderr, "debug: CWinApp(0x%08X)::Run\n", this);

	if (!AfxGetApp()->InitInstance()) {
		return FALSE;
	}

	MSG msg;
	BOOL bRet;

	// Start the message loop. 
 
	while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0) {
		if (bRet == -1) {
			// handle the error and possibly exit
		}
		else {
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
	} 

	return msg.wParam;
}
